home *** CD-ROM | disk | FTP | other *** search
/ Aminet 35 / Aminet 35 (2000)(Schatztruhe)[!][Feb 2000].iso / Aminet / dev / src / td01_src.lha / td_r0.1 / TesttdoLib2.c < prev   
Encoding:
C/C++ Source or Header  |  1999-04-17  |  1.6 KB  |  63 lines

  1. #include <exec/types.h>
  2. #include <exec/memory.h>
  3.  
  4. #include <tdo/tdo.h>
  5.  
  6. #include <pragma/exec_lib.h>
  7. #include <pragma/tdo_lib.h>
  8.  
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11.  
  12. struct tdoBase *tdoBase = NULL;
  13.  
  14. void main(long argc, char **argv)
  15. {
  16.  tdoBase = (APTR) OpenLibrary("tdo.library", 0);
  17.  if(tdoBase)
  18.  {
  19.    ULONG mesh,mat1,mat2;
  20.    TOCLColor color;
  21.    TOCLVertex v1,v2,v3;
  22.  
  23.   if((mesh = tdoMeshNew())!=RCNOERROR) {
  24.  
  25.     tdoMeshMaterialAdd(mesh,&mat1);
  26.     color.r=255,color.g=0,color.b=0;
  27.     tdoMeshMaterialAmbientColorSet(mesh,mat1,&color);
  28.     tdoMeshMaterialNameSet(mesh,mat1,"rot");
  29.     tdoMeshMaterialShininessSet(mesh,mat1,1);
  30.     tdoMeshMaterialTransparencySet(mesh,mat1,0);
  31.  
  32.     tdoMeshMaterialAdd(mesh,&mat2);
  33.     color.r=0,color.g=0,color.b=255;
  34.     tdoMeshMaterialAmbientColorSet(mesh,mat2,&color);
  35.     tdoMeshMaterialNameSet(mesh,mat2,"blau");
  36.     tdoMeshMaterialShininessSet(mesh,mat2,1);
  37.     tdoMeshMaterialTransparencySet(mesh,mat2,0);
  38.  
  39.     tdoMeshNameSet(mesh,"Quad");
  40.     v1.x=-10,v1.y=-10,v1.z=0;v2.x=10,v2.y=10,v2.z=0;v3.x=-10,v3.y=10,v3.z=0;
  41.     tdoMeshTriangleAdd(mesh,mat1,&v1,&v2,&v3);
  42.     v1.x=-10,v1.y=-10,v1.z=0;v2.x=10,v2.y=-10,v2.z=0;v3.x=10,v3.y=10,v3.z=0;
  43.     tdoMeshTriangleAdd(mesh,mat2,&v1,&v2,&v3);
  44.  
  45.     printf("Total number of vertices : %ld\n",tdoMeshNumberOfVerticesGet(mesh));
  46.     printf("Total number of polygons : %ld\n",tdoMeshNumberOfPolygonsGet(mesh));
  47.     printf("Total number of materials : %ld\n",tdoMeshNumberOfMaterialsGet(mesh));
  48.  
  49.     printf("%ld\n",tdoMeshSave3D(mesh,T3DFDXF,"ram:pout.dxf"));
  50.   
  51.     tdoMeshDelete(mesh);
  52.   }
  53.    
  54.   CloseLibrary((APTR) tdoBase);
  55.  
  56.   exit(0);
  57.  }
  58.  
  59.  printf("\nLibrary opening failed\n");
  60.  
  61.  exit(20);
  62. }
  63.